<?php


class StructTree extends WBTreeView { 
	public function __construct($options = array()) { 
		parent::__construct($options);
	}
	
	public function onClick($eo) { 
		
		$pm = wbobject('MainWindow')->getProjectManager();
		
		if ($pm) { 
			$node = $this->selectedNode();
			
			$control = wbobject($this->value);
	
			$temp = $pm->getCurrentControl();
			
			if ($temp) { 
				$temp->setSelected(false);
			}			 
			
			if ($control instanceof FormControl) {
				$control->setSelected(true);			 
				$pm->setCurrentControl($control);
			} else {
				$pm->setCurrentControl(null);
			}
			
			$pm->updateControl();
			$pm->refreshProject();
			
			$pm->setFocus(true);
		}
	}
}


?>